package com.v5ba.demo.web;
import com.v5ba.common.ResponseVO;
import com.v5ba.common.fen2yuan.Fen2Yuan;
import com.v5ba.common.header.Header;
import com.v5ba.common.openapi.OpenAPI;
import com.v5ba.demo.extend.vo.UserService;
import com.v5ba.sms.SmsUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class TestController {
    @Autowired
    private UserService userService;

    @GetMapping("hello")
    public String hello(String name, String age){
        System.out.println("开始");
        //smsUtil.send("18611912657", "");
        System.out.println(userService.getName());

        return name + age;
    }

    @OpenAPI
    @PostMapping("hai")
    public ResponseVO hai(HttpServletRequest request, @RequestHeader String userName, UserPO userPO){
        System.out.println("userName="+userName);
        System.out.println("业务逻辑name:"+userPO.getUserName());
        return ResponseVO.of("userName");
    }
    @PostMapping("nini")
    public ResponseVO nini(@Header HeaderParam param, @Header String userCode){
        return ResponseVO.of();
    }
}

